<table class="area-list" data-page="<#if pageIndex??>${pageIndex}<#else>1</#if>" data-page-size="<#if pageSize??>${pageSize}<#else>20</#if>" data-count="<#if count??>${count}<#else>0</#if>">
	<tr class="title-row">
		<th style="display:none"></th>
		<th>实验名称</th>
		<th>编码</th>
		<th>说明</th>
	</tr>
	<#if data??> <#list data as item>
	<tr>
		<td style="display:none">${item.id}</td>
		<td>${item.name}</td>
		<td>${item.code}</td>
		<td>${item.description}</td>
	</tr>
	</#list> </#if>				
</table>

<script src="${request.contextPath}/js/suredy-list.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		var listConfig = ({		
			header : true,
			footer : true,
			search : false,
			checkbox : true,	
			pageFieldName : 'page',
			pageSizeFieldName : 'size',					
			paginate : function(page, size, name) {
				var para = {
					page:page,
					size:size,
					name:name
				}
				$.suredy.loadContent('app/testItem/list.do', null, para);
			},
			
			btns : [ {
				text :'创建',
				icon : 'icon-plus',
				style : 'btn-default',
				click : function() {
					$.suredy.showModal({
						size : 'lg',
						icon : 'icon-plus',
						title : '创建区域信息',
						showFoot : false,
						uri : 'app/testItem/create.do'
					});
				}
			},{
				text :'修改',
				icon : 'icon-edit',
				style : 'btn-info',
				click : function() {
					var checked = $.suredy.list.checked($('.area-list'));
					if (checked.length == 0 ) {
						alert('请选择需要修改的实验项!');
						return;
					} else if (checked.length > 1) {
						alert('只能选择一个!');
						return;
					} else {
						var itemId = $( $( $.suredy.list.checked($('.area-list'))[0]).find('td' )[1] ).html();
						var uri = 'app/testItem/edit.do?itemId=' + itemId;
						$.suredy.showModal({
							size : 'lg',
							icon : 'icon-edit',
							title : '修改区域信息',
							showFoot : false,
							uri : uri
						});
					}				
				}
			}, {
				text :'删除',
				icon : 'icon-remove',
				style : 'btn-danger',
				click : function() {
					var checked = $.suredy.list.checked($('.area-list'));
					if (checked.length == 0 ) {
						alert('请选择需要删除的信息!');
						return;
					} else if (checked.length > 1) {
						alert('只能选择一条信息!');
						return;
					} else {
						var itemId = $( $( $.suredy.list.checked($('.area-list'))[0]).find('td' )[1] ).html();
						var uri = 'app/testItem/delete.do?itemId=' + itemId;
						var msg = '是否确认删除信息？\n\n\提示：\n\该操作将会删除检测项信息！\n\请谨慎操作！';
	
						if (!window.confirm(msg)) {
							return;
						}
						$.ajax({
							url : uri,
							type : 'POST',
							success : function(msg) {
								if (!msg) {
									alert('Unknown exception!');
								} else if (!msg.success) {
									alert("删除信息失败！\n\n" + msg.msg);
								} else {
									alert("删除信息成功！");
									$.suredy.loadContent('app/testItem/list.do');
								}
							},
							error : function(a, b, c) {
								alert('Server error! ' + b);
							}
						});
					}				
				}
			}]
		});	
		
		$('.area-list').list(listConfig);	
		
	});
</script>	